package form

import (
	"gitee.com/kordar/bucket/model"
	"github.com/kordar/gormext"
)

type BucketForm struct {
	ID     gormext.StrInt `json:"id"`
	Name   string         `json:"name" binding:"required"`
	Remark string         `json:"remark"`
	Driver string         `json:"driver" binding:"required"`
	Config string         `json:"config"`
}

func (s BucketForm) Target() interface{} {
	return &model.Bucket{
		ID:     int64(s.ID),
		Name:   s.Name,
		Remark: s.Remark,
		Driver: s.Driver,
		Config: s.Config,
	}
}

type BucketListForm struct {
	ID       gormext.StrInt64 `json:"id" binding:"required"`
	Dir      string           `json:"dir"`
	Next     interface{}      `json:"next"`
	Page     gormext.StrInt   `json:"page"`
	PageSize gormext.StrInt   `json:"pageSize"`
}

type BucketDelForm struct {
	ID       gormext.StrInt64 `json:"id" binding:"required"`
	Dir      string           `json:"dir"`
	FileName string           `json:"filename"`
}

type BucketDownloadForm struct {
	ID       gormext.StrInt64 `json:"id" binding:"required"`
	FileName string           `json:"filename" binding:"required"`
	Name     string           `json:"name" binding:"required"`
}

type BucketRenameForm struct {
	ID          gormext.StrInt64 `json:"id" binding:"required"`
	FileName    string           `json:"filename" binding:"required"`
	NewFilename string           `json:"new_filename" binding:"required"`
}

type BucketCopyForm struct {
	ID     gormext.StrInt64 `json:"id" binding:"required"`
	Files  []string         `json:"files" binding:"required"`
	Target string           `json:"target" binding:"required"`
}

type BucketUploadForm struct {
	ID     gormext.StrInt64 `json:"id"  form:"id" binding:"required"`
	Type   string           `json:"type"  form:"type" binding:"required"`
	Target string           `json:"target"  form:"target" binding:"required"`
}
